﻿namespace homework9._20
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //定义初始位置坐标
            int x=0, y=0;
            ConsoleKey input;
            do
            {
                //清屏
                Console.Clear();
                Console.SetCursorPosition(x, y);
                Console.Write("this is homework");
                //将用户输入设为变量
                input = Console.ReadKey(true).Key;
                //改变坐标值
                switch (input)
                {
                    case ConsoleKey.A:
                        if (x > 0)
                            x--;
                        break;
                    case ConsoleKey.W:
                        if (y > 0)
                            y--;
                        break;
                    case ConsoleKey.D:
                        if (x < 80)
                            x++;
                        break;
                    case ConsoleKey.S:
                        if (y < 80)
                        y++;
                        break;
                    default:
                        break;
                }
            }
            while (input != ConsoleKey.Enter);


            }

        }
    }
